package org.beeware.android.util;

import android.app.ActivityManager;
import android.content.Context;

public class ServiceUtil {
	/**
     * 获取当前进程名
     *
     * @param context
     * @return 进程名
     */
    public static String getProcessName(Context context){
        String processName="";
        ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

        for(ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()){
            if(processInfo.pid == android.os.Process.myPid()){
                processName=processInfo.processName;
            }
        }
        return processName;
    }
}
